//
// Created by sjjmw on 3/24/2022.
//
#include "iostream"
#include "vector"
#include "list"
#include "algorithm"
#include "string"
#include "unordered_map"
#include "cmath"
#include<iomanip>
#include "string"

//拷贝截取,排序，取对应下标
void handle(int k){
    std::vector<int> vec(k);
    for(int i=0;i<k;i++){
        std::cin>>vec[i];
    }
    int cnt;std::cin>>cnt;
    for (int i = 0; i < cnt; ++i) {
        int begin,end,index;
        std::cin>>begin>>end>>index;
        begin--;end--;
        std::vector<int> cut(end-begin+1);
        for(int j=begin;j<=end;j++){
            cut[j-begin]=vec[j];
        }
        std::sort(cut.begin(),cut.end(),std::greater<int>());
        printf("%d\n",cut[index-1]);
    }
//    std::sort(vec.begin(),vec.end());

}
int main(){
    int a,b,c;
    while (std::cin>>a){
        handle(a);
    }
    return 0;
}